package iterator;//package iterator;

import iterator.entity.Student;
import iterator.entity.Teacher;
import iterator.impl.PersonContainer;

public class Main {
    public static void main(String[] args) {
        Container container = new PersonContainer(11);
        container.add(new Teacher("刘老师", "语文"));
        container.add(new Teacher("刘老师1", "语文1"));
        container.add(new Teacher("刘老师2", "语文2"));
        container.add(new Teacher("刘老师3", "语文3"));
        container.add(new Student("小王", "可爱"));
        container.add(new Student("小王1", "可爱1"));
        container.add(new Student("小王2", "可爱2"));
        container.add(new Student("小王3", "可爱3"));
        for (Iterator iter = container.getIterator(); iter.hasNext();) {
            System.out.println("Name : " + iter.next());
        }
        System.out.println("---------------");
        for (Iterator iter = container.getStudentIterator(); iter.hasNext(); ) {
            System.out.println("Name : " + iter.next());
        }
    }
}
